identify panic and reboot/halt functions as noreturn
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 Mar 2014 10:17:03 +0000 (11:17 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 4 Mar 2014 10:17:03 +0000 (11:17 +0100)
On an x86 build (GCC Debian 4.7.2-5), this substantially reduces the size of
.text and .init.text sections.

Experimentally, even in a non-debug build, GCC uses `call` rather than `jmp`
so there should be no impact on any stack trace generation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/arm/shutdown.c
xen/arch/x86/cpu/mcheck/mce.h
xen/arch/x86/shutdown.c
xen/common/shutdown.c
xen/include/asm-arm/smp.h
xen/include/asm-x86/processor.h
xen/include/xen/lib.h
xen/include/xen/shutdown.h

index 767cc12ad40ac4ff832f361732d13b4c22a2051a..adc0529afdc713f49b251285fe6d8fc6505c164e 100644 (file)
@@ -11,7 +11,7 @@ static void raw_machine_reset(void)
     platform_reset();
 }
 
-static void halt_this_cpu(void *arg)
+static void noreturn halt_this_cpu(void *arg)
 {
     stop_cpu();
 }
index cbd123d555e49a04ffad466b05d46a1fe945477b..33bd1ab84c224f1be5ae3ddd34d449b3ccb9a121 100644 (file)
@@ -57,7 +57,7 @@ int mce_available(struct cpuinfo_x86 *c);
 unsigned int mce_firstbank(struct cpuinfo_x86 *c);
 /* Helper functions used for collecting error telemetry */
 struct mc_info *x86_mcinfo_getptr(void);
-void mc_panic(char *s);
+void noreturn mc_panic(char *s);
 void x86_mc_get_cpu_info(unsigned, uint32_t *, uint16_t *, uint16_t *,
                         uint32_t *, uint32_t *, uint32_t *, uint32_t *);
 
index 6143c40e36e101b0016bfaeecf103688c190c377..827515d6c00ece65e2b8b09a22cc9631cf2cdf18 100644 (file)
@@ -452,7 +452,7 @@ static int __init reboot_init(void)
 }
 __initcall(reboot_init);
 
-static void __machine_restart(void *pdelay)
+static void noreturn __machine_restart(void *pdelay)
 {
     machine_restart(*(unsigned int *)pdelay);
 }
index 9bccd34d8aaa4b2fdad4880c7f5ab943f3b0f2ea..fadb69be48211e0d2e8ff0ecaa502baac84aa26d 100644 (file)
@@ -17,7 +17,7 @@
 bool_t __read_mostly opt_noreboot;
 boolean_param("noreboot", opt_noreboot);
 
-static void maybe_reboot(void)
+static void noreturn maybe_reboot(void)
 {
     if ( opt_noreboot )
     {
index a1de03c32d1b36b9079ea868d95e36cc528dd38f..91b1e528c64269e1e71f856f25da28f5e97c3bfe 100644 (file)
@@ -15,7 +15,7 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
 #define raw_smp_processor_id() (get_processor_id())
 
-extern void stop_cpu(void);
+extern void noreturn stop_cpu(void);
 
 extern int arch_smp_init(void);
 extern int arch_cpu_init(int cpu, struct dt_device_node *dn);
index 4da545e5541c9c759887dd0fc8dc1ff9b4f4a2c7..498d8a75ef65867c4c7dffa675e7faeb20cfed51 100644 (file)
@@ -515,7 +515,7 @@ void show_registers(struct cpu_user_regs *regs);
 void show_execution_state(struct cpu_user_regs *regs);
 #define dump_execution_state() run_in_exception_handler(show_execution_state)
 void show_page_walk(unsigned long addr);
-void fatal_trap(int trapnr, struct cpu_user_regs *regs);
+void noreturn fatal_trap(int trapnr, struct cpu_user_regs *regs);
 
 void compat_show_guest_stack(struct vcpu *, struct cpu_user_regs *, int lines);
 
index 0d1a5d3a075aa84d12a977861f36ff0d96baed36..1369b2b114d8950ab56d5d63a83e6f9f4f0afeba 100644 (file)
@@ -87,7 +87,7 @@ extern void printk(const char *format, ...)
     __attribute__ ((format (printf, 1, 2)));
 extern void guest_printk(const struct domain *d, const char *format, ...)
     __attribute__ ((format (printf, 2, 3)));
-extern void panic(const char *format, ...)
+extern void noreturn panic(const char *format, ...)
     __attribute__ ((format (printf, 1, 2)));
 extern long vm_assist(struct domain *, unsigned int, unsigned int);
 extern int __printk_ratelimit(int ratelimit_ms, int ratelimit_burst);
index 2bee74889f51f574fa2402ac9ee64aaf9c96d506..f04905b56f23271cc9f72f5ec4f3fda76b2dacb3 100644 (file)
@@ -1,13 +1,15 @@
 #ifndef __XEN_SHUTDOWN_H__
 #define __XEN_SHUTDOWN_H__
 
+#include <xen/compiler.h>
+
 /* opt_noreboot: If true, machine will need manual reset on error. */
 extern bool_t opt_noreboot;
 
-void dom0_shutdown(u8 reason);
+void noreturn dom0_shutdown(u8 reason);
 
-void machine_restart(unsigned int delay_millisecs);
-void machine_halt(void);
+void noreturn machine_restart(unsigned int delay_millisecs);
+void noreturn machine_halt(void);
 void machine_power_off(void);
 
 #endif /* __XEN_SHUTDOWN_H__ */